class Solution {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {

        unordered_set<int> s;
        unordered_set<int> s_num(nums1.begin(), nums1.end());
     
        for(size_t i = 0; i < nums2.size(); ++i){
            if(s_num.find(nums2[i]) != s_num.end()) 
                s.insert(nums2[i]);
        }
        vector<int> res(s.begin(), s.end());
        return res;
    }
};